package com.next

class City
{
    String name

    Date createdDate = new Date()
    Date modifiedDate = new Date()

    static belongsTo = [province: Province]
    static hasMany = [districts: District]

    static constraints = {
        name maxSize: 64, unqiue: ['province']
        province nullable: true, blank: true
    }

    static mapping = {
        sort 'name'
    }

    def beforeUpdate()
    {
        modifiedDate = new Date()
    }

    String toString()
    {
        name
    }
}
